<?php
/**
 * Created by PhpStorm.
 * User: User
 * Date: 2017/10/16
 * Time: 19:14
 */
class  printer
{
    private  static $obj=null;

    private  function __construct()
    {

    }
    public  static  function  getInstance(){
        if (is_null(self::$obj))
        {
            self::$obj=new printer();
        }
        return self::$obj;
    }
}
$p1=printer::getInstance();
$p2=printer::getInstance();
var_dump($p1);
var_dump($p2);